package com.yc.springmvc.bean;

import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;
import java.util.Date;
import java.util.List;

@Data
public class Person {
    @NotEmpty(message = "账号不能为空")
    @Length(min = 2, max = 16, message = "账号长度必须是2~16个字符")
    String name;
    Integer age;
    Boolean student;
    @NotEmpty(message = "密码不能为空")
    @Length(min = 2, max = 16, message = "密码长度必须是2~16个字符")
    String pwd;
    @Email
    String email;
    @Past //过去时间
    //@Future //未来时间
    Date birthday;
    @Pattern(regexp = "1\\d{10}", message = "电话长度必须是1开头的11位数字")
    String phone;

    Person father;
    Person mother;
    List<Person> friends;
}
